unit RsaPrivateEncryptForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, RSAOpenSSL;

type
  TForm3 = class(TForm)
    Label2: TLabel;
    mmoRSAPublicKey: TMemo;
    ledtDecryptedStr: TLabeledEdit;
    lbledtEncryptedStr: TLabeledEdit;
    btnPrivateEncrypt: TButton;
    btnPrivateDecrypt: TButton;
    procedure btnPrivateEncryptClick(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    fRSAOpenSSL : TRSAOpenSSL;
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.btnPrivateEncryptClick(Sender: TObject);
begin
//  lbledtEncryptedStr.Text := fRSAOpenSSL.SHA1_Sign_PK(ledtDecryptedStr.Text);
  lbledtEncryptedStr.Text := fRSAOpenSSL.SHA1_Sign_PK(ledtDecryptedStr.Text, mmoRSAPublicKey.Text);
end;

procedure TForm3.FormCreate(Sender: TObject);
var
  aPathToPublickKey, aPathToPrivateKey: string;
begin
//  aPathToPublickKey := '1public.pem';
//  aPathToPrivateKey := 'pro22.pem';
  fRSAOpenSSL := TRSAOpenSSL.Create(aPathToPublickKey, aPathToPrivateKey);
end;

procedure TForm3.FormDestroy(Sender: TObject);
begin
  fRSAOpenSSL.Free;
end;

end.
